package site.assad.dao;


import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;
import site.assad.dao.mapper.UserMapper;
import site.assad.domain.User;

import java.util.List;

/**
 * Author: Al-assad 余林颖
 * E-mail: yulinying_1994@outlook.com
 * Date: 2017/12/15 11:03
 * Description:
 */
@Repository
public class UserDao {

    @Autowired
    private SqlSessionTemplate sessionTemplate;

    //演示查询操作
    public User getUserById(final int id){
        return sessionTemplate.getMapper(UserMapper.class).getUserById(id);
    }

    public User findUserByName(final String name){
        return sessionTemplate.getMapper(UserMapper.class).getUserByName(name);
    }

    public List<User> findUserByIcon(final String icon) {
        return sessionTemplate.getMapper(UserMapper.class).getUserByIcon(icon);
    }



}
